<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />   
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            box-sizing: border-box;
        }
        .login{
            width: 345px;
            height: 46px;
            border-radius: 23px;
            margin: 100px auto;
            background:rgba(124,136,255,1);
            position: relative;
        }
        .cirle{
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: white;
            color: #333;
            position: absolute;
            left: 5px;
            top: 3px;
            border: 5px solid rgba(124,136,255,1);
            text-align: center;
            font-size: 12px;
            line-height: 32px;
            user-select:none;
        }
        .top-cirle{
            top: -30px;
            box-shadow: 0 2px 0 rgba(124,136,255,1);
        }
    </style>
</head>
<body>
    <div class="login">
        <div class="cirle">登录</div>
    </div>
    <script>
        var loginBtn = document.querySelector('.login');
        var cirle    = document.querySelector('.cirle');
        var start = "";
        var end  = "";
        loginBtn.addEventListener('touchstart',function(e){
            cirle.className = "cirle top-cirle";
            start = e.changedTouches[0].clientX
        },false);
        loginBtn.addEventListener('touchmove',function(e){
            end = e.changedTouches[0].clientX;
            cirle.style.transition = "0"
            computedRagle()
        },false);
        loginBtn.addEventListener('touchend',function(e){
            cirle.className = "cirle";
            cirle.style.left = 0;
            var start = 0;
            var end  = 0;
        },false)
        function computedRagle(){
            var xVal = end - start;
            if (xVal > 0  && xVal < 300) {
                cirle.style.left = xVal+5+"px";
            }else{
                cirle.style.left = '305px';
            }
        }
    </script>
</body>
</html>